In [ ]:
 

One very useful feature of Folium is the possibility to create an animated heat map which changes based on a certian dimention (in this visualisation, hours) through using HeatMapWithTime() class method.

By creating a nested list where each position contains the coordinates (latitude and longitude) for all accidents in a given accident for a specific hour.

For instance, hr_list[2] contains all the accidents that occured 00:02:00 to 00:02:59 (e.g. hour_list[2] → [[lat1,lon1],[lat2,lon2],[lat3,lon3],…,[latn,logn]).

From exploring the visualisation and timeline zoomed in on Leeds, we can observe how the number of accidents increases from 07:00-08:00 hours and again from 14:00-18:00. Before, inbetween and after these observed intervals, the heat map highlights a lower frequency of accident occurance within the Leeds region.

In [38]:
heat_interactive_map()
Out[38]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [ ]: